<template>
	<view class="" style="background-color: #d70127;">
		<view class="content">
			<view class="item" v-for="(item,idx) in news" :key="idx" @click="$navTo('/pages/newInfo?id='+item.id)">
				<view class="df-flex" style="align-items: center;">
					<image :src="item.cover" mode="" v-if="item.cover"></image>
					<view class="text"> {{item.title }} </view>
				</view>
				<view class="time">
					{{item.createTime}}
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		newList
	} from '../request/api.js'
	export default {
		data() {
			return {
				news: []
			}
		},
		onLoad() {},
		onShow() {
			this.news = []
			this.getNewList()
		},
		methods: {
			getNewList() {
				newList().then(res => {
					if (res.code == 200) {
						this.news = [this.news, ...res.result.records]
					}
				})
			},
		}
	}
</script>
<style lang="scss">
	.content {
		min-height: 100vh;
		background: url('/static/image/bg2.png') no-repeat center center;
		background-size: 100% 100%;
		padding: 20rpx 30rpx 0;

		// overflow: hidden;
		.item {
			margin-top: 30rpx;
			border-bottom: 1px solid #fff;
			padding-bottom: 20rpx;

			image {
				width: 100rpx;
				height: 100rpx;
			}

			.text {
				color: #FDE8CE;
				margin-left: 20rpx;
			}

			.time {
				color: #FDE8CE;
				text-align: right;
			}
		}
	}
</style>